<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>全选</title>
		<style>
			body{
            background: url(images/list_bg.gif) no-repeat;
            background-size: 100%;
        }
        *{
            margin: 0;
            padding: 0;
        }
        #father{
            width: 1200px;
            margin: 0 auto;
        }
        span{
            font-weight: bold;
            margin: 118px;
        }
        #content{
            margin: 60px;
            border-bottom: 2px grey dotted;
        }
        p{
            margin-left: 190px;
            text-align: center;
        }
        input{
            text-align: center;
        }
        .shopimg{
            margin-left: 120px;
        }

        .center .a{
            display: flex;
            border-bottom: 2px grey dotted;
        }
        .inp{
            margin-left: 60px;
        }
    </style>
	</head>
	<body>
		<div id="father">
			<div id="content">
				<input type="checkbox" id="all" onclick="xuan()">全选
				<span>商品图片</span>
				<span>商品名称/出售者/联系方式</span>
				<span>价格</span>
			</div>
			<div class="center">
				<div class="a">
					<input type="checkbox" class="inp a">
					<img src="images/list0.jpg" class="shopimg">
					<p>
						杜比环绕，家庭影院必备，超真实享受<br />
						出售者：21juhu<br />
						<img src="images/online_pic.gif" alt="">
						<img src="images/list_tool_fav1.gif">收藏
					</p>
					<p>
						一口价<br />
						2323.4
					</p>
				</div>



			</div>
			<div class="center">
				<div class="a">
					<input type="checkbox" class="inp a">
					<img src="images/list1.jpg" class="shopimg">
					<p>
						杜比环绕，家庭影院必备，超真实享受<br />
						出售者：21juhu<br />
						<img src="images/online_pic.gif" alt="">
						<img src="images/list_tool_fav1.gif">收藏
					</p>
					<p>
						一口价<br />
						2323.4
					</p>
				</div>



			</div>
			<div class="center">
				<div class="a">
					<input type="checkbox" class="inp a">
					<img src="images/list2.jpg" class="shopimg">
					<p>
						杜比环绕，家庭影院必备，超真实享受<br />
						出售者：21juhu<br />
						<img src="images/online_pic.gif" alt="">
						<img src="images/list_tool_fav1.gif">收藏
					</p>
					<p>
						一口价<br />
						2323.4
					</p>
				</div>



			</div>
			<div class="center">
				<div class="a">
					<input type="checkbox" class="inp a">
					<img src="images/list3.jpg" class="shopimg">
					<p>
						杜比环绕，家庭影院必备，超真实享受<br />
						出售者：21juhu<br />
						<img src="images/online_pic.gif" alt="">
						<img src="images/list_tool_fav1.gif">收藏
					</p>
					<p>
						一口价<br />
						2323.4
					</p>
				</div>
			</div>
		</div>

		<script>
			function xuan() {
				var all = document.getElementById("all");
				var a = document.getElementsByClassName("a");
				if (all.checked == true) {
					for (var i = 0; i < a.length; i++) {
						a[i].checked = true;
					}
				} else {
					for (var i = 0; i < a.length; i++) {
						a[i].checked = false;
					}
				}
			}
		</script>
	</body>
</html>
